public class SyncDevice {
	public void syncdevice() {
		DBview chklist = new DBview();
		DBedit dosync = new DBedit();
		String sql = "select did from devicelist";
		String makesql = null;
		String[] schemalist = null;
		schemalist = chklist.schemaview("devicelog");
		String[][] tablelist = null;
		tablelist = chklist.tableview("smarthouse", sql);
		if (schemalist.length == 0) {
			for (int i = 0; i < tablelist[0].length; i++) {
				makesql = "CREATE TABLE `" + tablelist[1][i] + "` ("
						+ "`date` DATE NOT NULL," + "`time` TIME NOT NULL,"
						+ "`state` INT NOT NULL,"
						+ "PRIMARY KEY (`date`, `time`));";
				dosync.dbedit("devicelog", makesql);
			}
		}
		for (int i = 0; i < tablelist[0].length; i++) {
			for (int j = 0; j < schemalist.length; j++) {
				if (schemalist[j] == tablelist[0][i]) {
					continue;
				} else {
					makesql = "CREATE TABLE `" + tablelist[1][i] + "` ("
							+ "`date` DATE NOT NULL," + "`time` TIME NOT NULL,"
							+ "`state` INT NOT NULL,"
							+ "PRIMARY KEY (`date`, `time`));";
					dosync.dbedit("devicelog", makesql);
				}
			}
		}

	}
}
